package com.qimo.zzy.controller;


import com.qimo.zzy.service.MailService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@CrossOrigin//跨域
@RestController//遵循RestFul
@RequestMapping("/qimo/MessageSend/")
public class SendMailController {
    @Resource
    private MailService mailService;


    /**
     * 发送文本邮件
     *
     * @param to
     * @param subject
     * @param text
     */
    @RequestMapping("/sendTextMail")
    public String sendTextMail(String to, String subject, String text) {
        return mailService.sendTextMailMessage(to, subject, text);
    }

    /**
     * 发送图片
     *
     * @param to
     * @param subject
     * @param text
     * @return
     */
    @RequestMapping("/sendPhotoMailMessage")
    public String sendPhotoMailMessage(String to, String subject, String text) {
        return mailService.sendPhotoMailMessage(to, subject, text);
    }

    /**
     * 发送随机验证码
     *
     * @param to
     * @return
     */
    @RequestMapping("/sendRoundTextMailMessage")
    public String sendRoundTextMailMessage(String to) {
        return mailService.sendRoundTextMailMessage(to);
    }

}